<template>
  <div class="panel-left panel">
    <div class="tool-picker">
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="onSelectionBtnClick()">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>框选</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="createBaseShape('rectangle')">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>矩形</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="createBaseShape('circle')">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>圆形</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="createPolygonShape()">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>多边形</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="createSeatRow()">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>单行座</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="createSeatMatrix()">
          <svg-icon icon-class="list"/>
          <div class="icon-text">
            <span>矩阵座</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="undo()">
          <i class="el-icon-d-arrow-left"></i>
          <div class="icon-text">
            <span>撤销</span>
          </div>
        </div>
      </div>
      <div class="tool-group-wrapper">
        <div class="tool-group" @click="redo()">
          <i class="el-icon-d-arrow-right"></i>
          <div class="icon-text">
            <span>恢复</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ToolBar",
  components: {},
  data() {
    return {
      selectTool: null,
      isSelect: false
    };
  },
  mounted() {},
  methods: {
    onSelectionBtnClick() {
      this.$emit("onSelectionBtnClick");
    },
    createBaseShape(shape) {
      this.$emit("onCreateBaseShape", shape);
    },
    createPolygonShape() {
      this.isSelect = !this.isSelect;
      this.$emit("createPolygonShape", this.isSelect);
    },
    createSeatRow() {
      this.isSelect = !this.isSelect;
      this.$emit("createSeatRow", this.isSelect);
    },
    createSeatMatrix() {
      this.isSelect = !this.isSelect;
      this.$emit("createSeatMatrix", this.isSelect);
    },
    undo() {
      this.$emit("undo");
    },
    redo() {
      this.$emit("redo");
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/style/variables.scss";
.panel-left {
  position: absolute;
  top: 0;
  bottom: 0;
  box-sizing: border-box;
  width: $toolBarWidth;
  padding: 5px 0;
  height: 100%;
  border-right: 1px solid hsla(0, 0%, 0%, 0.08);
  .tool-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    .separator {
      height: 1px;
      width: 100%;
      background: hsla(0, 0%, 60%, 0.3);
      margin: 4px 0;
    }
    .tool-group-wrapper {
      width: $toolBarWidth;
      height: $toolBarWidth;
      cursor: pointer;
      & + .tool-group-wrapper {
        margin-top: 5px;
      }
      .tool-group {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .icon-text {
          font-size: 12px;
        }
      }
      .default-icon {
        color: #242424;
        font-size: 20px;
      }
      .active-icon {
        color: #0784fa;
        font-size: 20px;
      }
    }
  }
}
</style>
